<?php
// +----------------------------------------------------------------------
// | Author: yaoyihong <510974211@qq.com>
// +----------------------------------------------------------------------

namespace app\api\model;

class PostsImages extends ApiBase
{
	public function getThumbAttr($value, $data)
    {
        if ($value && !preg_match('/^http(s)?:\\/\\/.+/', $value)) {
            return SITE_PATH . $value;
        } else {
            return $value;
        }
    }

    public function getUrlAttr($value, $data)
    {
        if ($value && !preg_match('/^http(s)?:\\/\\/.+/', $value)) {
            return SITE_PATH . $value;
        } else {
            return $value;
        }
    }

	public function postss(){
        return $this->belongsTo('Posts','posts_id','id');
    }
}